﻿using MicroCloud.Entity.Database;

namespace MicroCloud.CodeGenerator.Startups
{
    public class DesignTimeDefaultDbContextFactory : DesignTimeDbContextFactory<DefaultDbContext>
    {
        public DesignTimeDefaultDbContextFactory()
            : base(null)
        { }

        public DesignTimeDefaultDbContextFactory(IServiceProvider serviceProvider)
            : base(serviceProvider)
        { }

        ///// <summary>
        ///// 创建设计时使用的ServiceProvider，主要用于执行 Add-Migration 功能
        ///// </summary>
        ///// <param name="services">服务集合</param>
        ///// <returns>服务提供者</returns>
        //protected override IServiceProvider CreateDesignTimeServiceProvider(IServiceCollection services)
        //{
        //    services ??= new ServiceCollection();

        //    Startup startup = new();
        //    startup.ConfigureServices(services);

        //    IServiceProvider provider = services.BuildServiceProvider();
        //    return provider;
        //}

    }
}